package demo;

import org.openjdk.jcstress.annotations.*;
import org.openjdk.jcstress.infra.results.I_Result;

/**
 * @program: jmm
 * @description:
 * @author: zhanghz001
 * @create: 2020-12-29 16:06
 **/

public class SubAdd {
    @JCStressTest
    @Outcome(id = {"10"}, expect = Expect.ACCEPTABLE, desc = "ACCEPTABLE")
    @Outcome(id = {"5", "15"}, expect = Expect.ACCEPTABLE_INTERESTING, desc = "ACCEPTABLE_INTERESTING")
    @State
    public static class case1 {
        int balance = 10;
        
        @Actor
        public void deposit() {
            balance += 5;
        }
        
        @Actor
        public void withdraw() {
            balance -= 5;
        }
        
        @Arbiter
        public void query(I_Result r) {
            r.r1 = balance;
        }
    }
}
